teams: smoother user repository task realm handling (fixes #9032)#9010
teams: smoother user repository task realm handling (fixes #9032)#9010
Conversation
- Injected `UserRepository` into `AdapterTask` to handle user data fetching. - Removed direct `Realm` instance calls from `showAssignee` to prevent per-item database queries. - Updated `TeamTaskFragment` to provide the `UserRepository` to the adapter. This change improves RecyclerView performance by centralizing data access and reducing synchronous I/O on the main thread.
- Injected `UserRepository` into `AdapterTask` to handle user data fetching. - Removed direct `Realm` instance calls from `showAssignee` to prevent per-item database queries. - Updated `TeamTaskFragment` to use the inherited `userRepository` and pass it to the adapter. - Fixed a compilation error caused by a duplicate `UserRepository` injection. This change improves RecyclerView performance by centralizing data access and reducing synchronous I/O on the main thread.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| private fun updatedTeamTaskList(updatedList: RealmResults<RealmTeamTask>) { | ||
| viewLifecycleOwner.lifecycleScope.launch { | ||
| adapterTask = AdapterTask(requireContext(), updatedList, !isMemberFlow.value, viewLifecycleOwner.lifecycleScope) | ||
| adapterTask = AdapterTask(requireContext(), updatedList, !isMemberFlow.value, viewLifecycleOwner.lifecycleScope, userRepository) | ||
| adapterTask.setListener(this@TeamTaskFragment) | ||
| binding.rvTask.adapter = adapterTask |
There was a problem hiding this comment.
Inject UserRepository into TeamTaskFragment
The new adapter constructor requires a UserRepository, and TeamTaskFragment now passes userRepository when creating AdapterTask. However, this fragment does not declare or inject a UserRepository field anywhere, so the references at the adapter instantiations fail to compile with Unresolved reference: userRepository. Add an @Inject lateinit var userRepository: UserRepository (or equivalent constructor injection) before using it; otherwise the module cannot build.
Useful? React with 👍 / 👎.
UserRepositoryintoAdapterTaskto handle user data fetching.Realminstance calls fromshowAssigneeto prevent per-item database queries.TeamTaskFragmentto provide theUserRepositoryto the adapter.This change improves RecyclerView performance by centralizing data access and reducing synchronous I/O on the main thread.
https://jules.google.com/session/18431213191892173805